package com.hg.library.widget;

import android.content.Context;
import android.view.View;

import java.util.List;

/**
 * Created by ASUS-PC on 2016/7/14.
 */
public abstract class CuteCommonAdapter<S> extends CuteAdapter<S> {

    protected final String TAG = getClass().getSimpleName();

    protected Context mContext;
    private List<S> list;
    private int layoutId;
    private View view;

    public CuteCommonAdapter(Context mContext, List<S> list, int layoutId) {
        this.mContext = mContext;
        this.list = list;
        this.layoutId = layoutId;
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    @Override
    public S getItemData(int position) {
        return list.get(position);
    }

    @Override
    public View onCreateView(int position, S s) {
        return View.inflate(mContext,layoutId,null);
    }

    @Override
    public View onHolderView(View view, int position, S s) {
        convert(view,position,s);
        return view;
    }

    public abstract void convert(View view, int position, S s);

}
